import { http } from "@/utils/http";

/**
 * 获取全部菜单
 */
export const getMenuList = () => {
  return http.request("get", "/admin/admin/get/menus");
};
/** 添加菜单 */
export const addMenu = (data?: any) => {
  return http.request("post", "/admin/admin/add/menu", { data });
};
/** 添加菜单 */
export const setMenu = (data?: any) => {
  return http.request("post", "/admin/admin/update/menu", { data });
};
/**
 * 获取全部角色
 */
export const getRoleList = () => {
  return http.request("get", "/admin/admin/get/roles");
};
/** 添加角色 */
export const addRole = (data?: any) => {
  return http.request("post", "/admin/admin/add/role", { data });
};
/** 修改角色 */
export const setRole = (data?: any) => {
  return http.request("post", "/admin/admin/update/role", { data });
};
/** 关联角色 */
export const attachRole = (data?: any) => {
  return http.request("post", "/admin/admin/menuAttach/role", { data });
};
/**
 * 获取全部键值对列表
 */
export const getKvList = () => {
  return http.request("post", "/admin/common/kv/list");
};
/**
 * 获取键值
 */
export const getKvInfo = (id: number) => {
  return http.request("post", "/admin/common/kv/info", { data: { id } });
};
/** 添加键值对
 * @param key,value,remark,status
 */
export const addKv = (data?: any) => {
  return http.request("post", "/admin/common/kv/add", { data });
};
/** 修改键值对
 * @param key,value,remark,status
 */
export const updateKv = (data?: any) => {
  return http.request("post", "/admin/common/kv/update", { data });
};
/**
 * 获取全部字典列表
 */
export const getDictList = () => {
  return http.request("post", "/admin/common/dictionary/list");
};
/** 修改字典
 * @param name,value,
 */
export const updateDict = (data?: any) => {
  return http.request("post", "/admin/common/dictionary/set", { data });
};
/**
 *
 * @returns 全统计数据
 */
export const getStats = () => {
  return http.request("post", "/admin/index/stats/index");
};
